Skip to content

updated first_solar_spectral_correction within atmosphere.py - #208

Merged
wholmgren merged 3 commits into
pvlib:masterfrom
MLEEFS:new_spectral
Jul 11, 2016
Merged

wholmgren merged 3 commits into
pvlib:masterfrom
MLEEFS:new_spectral

Conversation

@MLEEFS

@MLEEFS MLEEFS commented Jul 7, 2016

Copy link
Copy Markdown
Contributor

I updated first_solar_spectral_correction within atmosphere.py to account for changes in model that are reflected in the IEEE PVSC 43 publication. I also added data flags/filters in order to make sure that the function doesn't "blow up" when given extraordinary inputs.

Minimum precipitable water floor is set to 0.1cm. This presents the function from going toward -Inf as precipitable water goes to toward zero.

An absolute airmass ceiling is placed at AM = 10. This prevents function from destabilizing at very high AM. AM > 10 occur very close to sunset/sunrise when irradiance levels are very low.

Warning flags are now printed if Pwat is really high (above 8 cm), or if absolute air mass is very low (below .58)

account for changes in model that are reflected in the IEEE PVSC 43 publication
@wholmgren

Copy link
Copy Markdown
Member

Thanks, @MLEEFS. Looks good, just a few simple things...

It's best to replace the print statements with warnings.warn. This way, users can silence the warnings if they want to. I am ambivalent about input warnings for pvlib python, but if you want to use them, that's the way to do it.

You should also replace the limit setting with the np.maximum and np.minimum functions. For example:

pw = np.maximum(pw, 0.1)

These numpy functions should be much faster than the list comprehensions and I think they're more readable.

I'm a little surprised to see that the tests still passed without any modification, so your changes to the coefficients must amount to pretty small changes in output over the tested range (1-5 cm and 1-5 airmasses).

…porate recommendations from wholmgren. I replaced list comprehensions with numpy functions, and replaced print statements with warnings
@MLEEFS

MLEEFS commented Jul 8, 2016

Copy link
Copy Markdown
Contributor Author

Hi @wholmgren ,

I made the changes you requested. Can you confirm that they have been made? I am still getting used to the mechanics of GIT.

Comment thread pvlib/atmosphere.py Outdated
Laboratory, 2014. http://www.nrel.gov/docs/fy14osti/61610.pdf
"""

import pdb

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll need to delete these pdb lines. They prevent the test suite from completing.

Comment thread pvlib/atmosphere.py
modifier = (
coeff[0] + coeff[1]*AMa + coeff[2]*pw + coeff[3]*np.sqrt(AMa) +
+ coeff[4]*np.sqrt(pw) + coeff[5]*AMa/pw)
+ coeff[4]*np.sqrt(pw) + coeff[5]*AMa/np.sqrt(pw))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like I made a mistake when I first ported this and put two + signs here (one on each line). Let's keep only the first one.

@MLEEFS

MLEEFS commented Jul 8, 2016

Copy link
Copy Markdown
Contributor Author

the "bonus" lines of code should be removed

@wholmgren

Copy link
Copy Markdown
Member

Thanks @MLEEFS. merging...

@wholmgren
wholmgren merged commit 58d77ea into pvlib:master Jul 11, 2016
@MLEEFS
MLEEFS deleted the new_spectral branch July 11, 2016 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants